package com.livesource.client.web.sourceCode.viewOptions;

import com.google.gwt.user.client.ui.HorizontalPanel;
import com.livesource.client.model.entry.ProjectClass;
import com.livesource.client.utilities.FileExtensions;

public class OptionsIcons extends HorizontalPanel {

	public static final String OPTION_DESCRIPTION = "description";
	public static final String OPTION_TEST = "test";
	public static final String OPTION_SOURCE = "source";

	public static ButtonFeatureDescription buttonDescription;
	public static ButtonEditFeature buttonEditFeature;
	public static ButtonTest buttonTest;
	public static ButtonJavadoc buttonJavadoc;
	public static ButtonSourceCode buttonSourceCode;

	public OptionsIcons(ProjectClass entry) {

		setSpacing(10);

		buttonDescription = new ButtonFeatureDescription(entry);
		add(buttonDescription);

		if (FileExtensions.EXTENSION_JAVA.equals(entry.getFileExtension())) {

			buttonEditFeature = new ButtonEditFeature(entry);
			add(buttonEditFeature);

			buttonTest = new ButtonTest(entry);
			add(buttonTest);

			buttonJavadoc = new ButtonJavadoc(entry);
			add(buttonJavadoc);
		}

		buttonSourceCode = new ButtonSourceCode(entry);
		add(buttonSourceCode);
	}

	public static void toggledButtons(ProjectClass entry) {

		buttonDescription.setHTML(ButtonFeatureDescription.imageUnpressed);

		if (FileExtensions.EXTENSION_JAVA.equals(entry.getFileExtension())) {

			buttonEditFeature.setHTML(ButtonEditFeature.imageUnpressed);
			buttonJavadoc.setHTML(ButtonJavadoc.imageUnpressed);
			buttonTest.setHTML(ButtonTest.imageUnpressed);
		}
		buttonSourceCode.setHTML(ButtonSourceCode.imageUnpressed);
	}

	public static void hideHints() {

		buttonDescription.descriptionHint.hide();
		buttonEditFeature.editHint.hide();
		buttonJavadoc.javadocHint.hide();
		buttonTest.testHint.hide();
		buttonSourceCode.sourceHint.hide();
	}
}
